<?php
namespace app\admin\controller;
use controller\BasicAdmin;
use think\Db;
use app\admin\model\capiModel;
class Admincapitalwater extends BasicAdmin{
    public $table ='capital_water';
    public function index(){
        list($get, $db) = [$this->request->get(), Db::name($this->table)->alias('a')->join('t_user b','a.uid=b.id','LEFT')
        ->join('t_shop c','a.shopid=c.id','LEFT')->join('t_order d','a.order_id=d.id','LEFT')->field('a.*,b.username,c.name as sname,d.sn')
        ];
        if(isset($get['sn'])&& $get['sn']!=''){
            $db->where(['d.sn'=>$get['sn']]);
        }
        $list = parent::_list($db->order('addtime DESC'),1,'','');

        $capiModel = new capiModel();
        $type = $capiModel::cApiType();
        foreach ($list['list'] as $k=>$v){
            $list['list'][$k]['typename']  = $type[$v['type']];
        }
        return $this->fetch('', ['title' => '订单跟踪列表','list'=>$list]);
    }
}